<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //网络请求之间有没有依赖关系？  很多接口可能要依赖上一个接口的数据才能执行
        function ajax(url){
            return new Promise(function(resolve,reject){
                $.getJSON(url,function(result){
                    resolve(result)
                },function(error){
                    reject(error)
                })
            })
        }
//请求响应的知识点
        async function getInfo(){
            var id = await ajax("http://iwenwiki.com/api/generator/list.php");
            var info = await ajax("http://iwenwiki.com/api/generator/id.php?id=" + id[0]);
            var result = await ajax("http://iwenwiki.com/api/generator/name.php?name=" + info.name);
            console.log(result);
            // result.then(data =>{
            //     console.log(data);
                
            // },error=>{
            //     console.log(error);
                
            // })
            
        }

        getInfo();
    </script>
</body>
</html>